var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/imp/cpts/components/SourceTreeTable.tsx
var SourceTreeTable_exports = {};
__export(SourceTreeTable_exports, {
  default: () => SourceTreeTable_default
});
module.exports = __toCommonJS(SourceTreeTable_exports);
var import_react = require("react");
var import_functionalComponent = require("../../../../functionalComponent");
var import_util = require("../../../../util");
var import_query_panel = require("../../../query-panel");
var import_service = require("../../service");
var import_NoticeIconContent = __toESM(require("./NoticeIconContent"));
var SourceTreeTable = (props) => {
  const { getRef, state, popupMode, flowCode, busData, rowDisable, iconVisible } = props;
  const tableRequest = (0, import_react.useCallback)(
    (defaultParams) => {
      const sourceId = state.sourceId;
      const newsourceId = (sourceId == null ? void 0 : sourceId.indexOf("_")) ? import_util.iup.split(sourceId, "_")[1] : sourceId;
      return (0, import_service.loadSourceData)({ flowCode, busData, ...defaultParams, popupMode, sourceId: newsourceId });
    },
    [popupMode, state.sourceId]
  );
  const onSearch = (_, queryCondition) => {
    var _a, _b;
    (_b = (_a = getRef("table")) == null ? void 0 : _a.current) == null ? void 0 : _b.getApi().setExtraParam({ queryCondition });
  };
  return /* @__PURE__ */ React.createElement(import_util.Layout.Flex, { direction: "column" }, state.queryItems.length > 0 && /* @__PURE__ */ React.createElement(import_query_panel.QueryPanel, { items: state.queryItems, onSearch }), /* @__PURE__ */ React.createElement(import_NoticeIconContent.default, { iconVisible }, /* @__PURE__ */ React.createElement(
    import_functionalComponent.Table,
    {
      ref: getRef("table"),
      isTree: true,
      key: state.sourceId,
      autoLoad: true,
      tableAlertRender: false,
      rowSelection: {
        type: state.allowMultiSelect == 1 ? import_functionalComponent.TableSelectionModel.CHECKBOX : import_functionalComponent.TableSelectionModel.ROW,
        autoCheckedChildren: true,
        disabled: rowDisable
      },
      keyField: "id",
      columns: state.columns,
      request: tableRequest
    }
  )));
};
var SourceTreeTable_default = (0, import_react.memo)(SourceTreeTable);
